# 以最新的Ubuntu镜像为模板
FROM ubuntu:18.04

# 将本目录下的sources.list作为容器的一个文件
ADD sources.list /root/sources.list
# 使用阿里Ubuntu源，更新快
#RUN mv /etc/apt/sources.list  /etc/apt/sources.list_bak
#RUN cp /root/sources.list  /etc/apt/sources.list

# 复制配置文件到相应位置,并赋予脚本可执行权限
ADD run.sh /run.sh
RUN chmod 755 /run.sh

RUN apt-get update
# 安装ssh
RUN apt-get install -y openssh-server
RUN mkdir -p /var/run/sshd

# 修改root密码，便于远程登录
RUN echo root:root | chpasswd
# 配置ssh可以使用root登陆
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

RUN ln -sf /bin/bash /bin/sh

# 安装sudo 为用户使用
RUN apt-get install -y sudo

# 添加svk，便于远程登录编译(Bitbake 不容许root)
# 增加一个新用户，名为 svk
# 让这个用户有 root 权限
# 设置其密码为 svk
# container启动后以 svk 登录,并且直接到svk的home目录下
RUN useradd --create-home --no-log-init --shell /bin/bash svk
RUN adduser svk sudo
RUN echo 'svk:svk' | chpasswd

# 添加cjtech
RUN useradd --create-home --no-log-init --shell /bin/bash cjtech
RUN adduser cjtech sudo
RUN echo 'cjtech:cjtech' | chpasswd

# 安装vim
RUN apt-get install -y vim

# 安装ifconfig
RUN apt-get install -y net-tools

#####################################8916 android4.4#############################
# 8916 ap 编译环境
#RUN apt-get install -y git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip python-networkx

#fix bc not cannot found by compile kernel
#RUN apt-get install bc

#fix bitbake -fc menuconfig linux-quic 
#RUN apt-get install -y tmux

#jdk1.6 
# Volume 挂载 这里没有使用
# #Volume /opt/
# 和COPY一样，复制文件到指定目录，但是COPY不能解压，ADD自动解压 
#ADD jdk1.6.0_45.tar.gz /opt/

# JAVA_JDK_HOME 为ssh 登录 添加环境 此处 ‘’ 很关键 
#RUN echo export JAVA_JDK_HOME=/opt/jdk1.6.0_45 >> /etc/profile
#RUN echo export PATH='${JAVA_JDK_HOME}/bin:$PATH' >> /etc/profile

# 只能为docker exec 添加环境 不能 ssh -p svk@localhost 不能生效
#ENV JAVA_HOME /opt/jdk1.6.0_45
#ENV PATH $PATH:${JAVA_HOME}/bin
################################ 8916-ap end ########################################### 

##################################qm215 android10 ###################################
#RUN apt-get install -y git-core gnupg flex bison gperf libsdl1.2-dev \
#  squashfs-tools build-essential zip curl \
#  libncurses5-dev zlib1g-dev pngcrush schedtool libxml2 libxml2-utils \
#  xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev \
#  gcc-multilib libswitch-perl

#RUN apt-get install -y gcc-arm-linux-gnueabihf \
#  libssl-dev \
#  p7zip-full

#fix bc not cannot found by compile kernel
#RUN apt-get install bc

#fix bitbake -fc menuconfig linux-quic
#RUN apt-get install -y tmux

#fix compile error
#RUN apt-get install -y mkisofs
#RUN apt-get install -y rsync

#openjdk 8
#RUN apt-get install -y openjdk-8-jdk
##################################qm215 android10 end ####################################

###################################qm215 sbl ##############################################
ADD ARM.tar.bz2 /opt/

# scons 需要用python2.7
RUN apt-get install -y python

# armcc 是i386 运行在 x86_64
RUN apt-get install -y libc6-dev-i386

#
#RUN apt-get install -y libgl1-mesa-dev g++-multilib git flex bison gperf build-essential
#RUN apt-get install -y tofrodos python-markdown libxml2-utils xsltproc 
#RUN apt-get install -y dpkg-dev libsdl1.2-dev 
#RUN apt-get install -y git-core gnupg flex bison gperf build-essential
#RUN apt-get install -y zip curl zlib1g-dev gcc-multilib g++-multilib
#RUN apt-get install -y libc6-dev-i386
#RUN apt-get install -y lib32ncurses5-dev x11proto-core-dev libx11-dev
#RUN apt-get install -y libgl1-mesa-dev libxml2-utils xsltproc unzip m4
#RUN apt-get install -y lib32z1-dev ccache
#RUN apt-get install -y bc python flex bison gperf libsdl-dev build-essential zip curl
#RUN apt-get install -y libssl-dev  liblz4-tool
#RUN apt-get install -y libesd-java libwxgtk3.0-dev squashfs-tools   pngcrush schedtool libxml2
#RUN apt-get install -y lzop  schedtool   lib32readline-dev  libswitch-perl libssl-dev
#RUN apt-get install -y mkisofs


####################################qm215-sbl end #########################################

#USER svk
#WORKDIR /home/svk

# 开放22端口
EXPOSE 22
#设置自启动命令
CMD ["/run.sh"]

